
#ifndef MATERIALXMLEXPORTER_H
#define MATERIALXMLEXPORTER_H

#include <qdom.h>
#include <qstring.h>
#include <qset.h>

class cceMaterialEffect;
class cceMaterialManager;
class cceMaterialMaterial;
class cceMaterialProgram;
class cceMaterialShader;
class cceMaterialTexture;
class cceMaterialXMLExporter
{
private:
	cceMaterialManager	*_manager;

	QSet<QString>				_textureNames;

	void PrepareDeploymentPath(const QString& subdirectory, bool clear = true);

private:

	void ExportTextures ();
	void ExportTextures (QDomDocument &doc);
	void ExportTexture (QDomDocument &doc, QDomElement &parent, cceMaterialTexture *texture);

  void ExportShaders ();
  void ExportShaders (QDomDocument &doc);
  void ExportShader (QDomDocument &doc, QDomElement &parent, cceMaterialShader *shader);

  void ExportPrograms ();
  void ExportPrograms (QDomDocument &doc);
  void ExportProgram (QDomDocument &doc, QDomElement &parent, cceMaterialProgram *program);

  void ExportEffects();
  void ExportEffects(QDomDocument &doc);
  void ExportEffect (QDomDocument &doc, QDomElement &parent, cceMaterialEffect *effect);

  void ExportMaterials ();
  void ExportMaterials (QDomDocument &doc);
  void ExportMaterial (QDomDocument &doc, QDomElement &parent, cceMaterialMaterial *material);

  void ExportResources ();

public:
	cceMaterialXMLExporter(cceMaterialManager* manager);

	void ExportAll ();

};

#endif // MATERIALXMLEXPORTER_H
